package printstream;

import java.io.FileNotFoundException;
import java.io.PrintWriter;

/**
 * @author DCSGO
 * @version 1.0
 * 打印流：PrintWriter 和 PrintStream
 */
public class PrintWriter_ {
    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter pw = new PrintWriter(System.out);
        pw.println("hi 网易云音乐");//hi 网易云音乐
        pw.flush();//刷新流 将字符写入到指定的: System.out(显示器) 中

        String filePath = "C:\\Users\\Administrator\\Desktop\\Javacode\\java-learning-code\\chapter19\\src\\printstream\\f2.txt";
        pw = new PrintWriter(filePath);
        pw.println("hi QQ音乐");

        //和其他字符流一样 写入数据都需要 flush 或 close 才能写入成功
        pw.close();
    }
}
